<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<link href="__STATIC__/css/admin/style.css" rel="stylesheet"/>
	<title><?php echo L('website_manage');?></title>
	<script>
	var URL = '__URL__';
	var SELF = '__SELF__';
	var ROOT_PATH = '__ROOT__';
	var APP	 =	 '__APP__';
	//语言项目
	var lang = new Object();
	<?php $_result=L('js_lang');if(is_array($_result)): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($i % 2 );++$i;?>lang.<?php echo ($key); ?> = "<?php echo ($val); ?>";<?php endforeach; endif; else: echo "" ;endif; ?>
	</script>
</head>

<body>
<div id="J_ajax_loading" class="ajax_loading"><?php echo L('ajax_loading');?></div>
<?php if(($sub_menu != '') OR ($big_menu != '') OR ($ajaxMenuList != '')): ?><div class="subnav">
    <div class="content_menu ib_a blue line_x">
    	<?php if(!empty($big_menu)): ?><a class="add fb J_showdialog" href="javascript:void(0);" data-uri="<?php echo ($big_menu["iframe"]); ?>" data-title="<?php echo ($big_menu["title"]); ?>" data-id="<?php echo ($big_menu["id"]); ?>" data-width="<?php echo ($big_menu["width"]); ?>" data-height="<?php echo ($big_menu["height"]); ?>"><em><?php echo ($big_menu["title"]); ?></em></a>　<?php endif; ?>

        <?php if(!empty($ajaxMenuList)): if(is_array($ajaxMenuList)): foreach($ajaxMenuList as $key=>$big_menu): ?><a class="add fb J_showdialog" href="javascript:void(0);" data-uri="<?php echo ($big_menu["iframe"]); ?>" data-title="<?php echo ($big_menu["title"]); ?>" data-id="<?php echo ($big_menu["id"]); ?>" data-width="<?php echo ($big_menu["width"]); ?>" data-height="<?php echo ($big_menu["height"]); ?>"><em><?php echo ($big_menu["title"]); ?></em></a>　<?php endforeach; endif; endif; ?>      
        <?php if(!empty($sub_menu)): if(is_array($sub_menu)): $key = 0; $__LIST__ = $sub_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($key % 2 );++$key; if($key != 1): ?><span>|</span><?php endif; ?>
        <a href="<?php echo U($val['moduleName'].'/'.$val['actionName'],array('menuid'=>$menuid)); echo ($val["data"]); ?>" class="<?php echo ($val["class"]); ?>"><em><?php echo L($val['name']);?></em></a><?php endforeach; endif; else: echo "" ;endif; endif; ?>
    </div>
</div><?php endif; ?>
<!--管理-->
<div class="pad_lr_10">
  <form name="searchform" method="get" >
    <table width="100%" cellspacing="0" class="search_form">
        <tbody>
            <tr>
                <td>
                <div class="explain_col">
                    <input type="hidden" name="g" value="admin" />
                    <input type="hidden" name="m" value="sales" />
                    <input type="hidden" name="a" value="index" />
                    <input type="hidden" name="menuid" value="<?php echo ($menuid); ?>" />
                     <b>搜索条件：</b><br />
                     销售时间 ：
                    <input type="text" name="time_start" id="time_start" class="date" size="12" value="<?php echo ($search["time_start"]); ?>">
                    -
                    <input type="text" name="time_end" id="time_end" class="date" size="12" value="<?php echo ($search["time_end"]); ?>">
					
                &nbsp;&nbsp;请选择厅店：
                <select class="J_cate_select mr10" data-pid="0" data-uri="<?php echo U('region/ajax_getchilds',array('max_level'=>4,'type'=>'store'));?>" data-selected="<?php echo ($search["selected_ids"]); ?>"></select>
                <input type="hidden" name="regionId" id="J_cate_id" value="<?php echo ($search["cate_id"]); ?>" />                   

                &nbsp;&nbsp;请选择品牌：
                <select name="brandId" id="brand_select_add">
                    <option value="">请选择品牌</option>
                    <?php if(is_array($brandList)): $i = 0; $__LIST__ = $brandList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$item): $mod = ($i % 2 );++$i;?><option <?php if($key == $search['brandId']): ?>selected=""<?php endif; ?> value="<?php echo ($key); ?>"><?php echo ($item); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                </select>
				&nbsp;&nbsp;请选择机型：
                <select name="modelId" id="model_select_add">
                    <option value="0"><?php echo L('please_select_brand');?></option>
                    
                </select> 
			     
                &nbsp;&nbsp;员工 :
                <input name="userName" type="text" class="input-text" size="12" value="<?php echo ($search["userName"]); ?>" />
                &nbsp;&nbsp;imei :
                <input name="imei" type="text" class="input-text" size="12" value="<?php echo ($search["imei"]); ?>" />                
                &nbsp;&nbsp;<?php echo L('store_channel');?>:
                <select name="channel">
                    <option value="">-<?php echo L('all');?>-</option>
                    <option value="1" <?php if($search["channel"] == '1'): ?>selected="selected"<?php endif; ?>><?php echo L('store_channel1');?></option>
                    </select> 
                &nbsp;&nbsp;验证:
                <select name="verify">
                    <option value="">-<?php echo L('all');?>-</option>
                    <option value="1" <?php if($search["verify"] == '1'): ?>selected="selected"<?php endif; ?>>通过</option>
                    <option value="-1" <?php if($search["verify"] == '-1'): ?>selected="selected"<?php endif; ?>>不通过</option>
                    <option value="0" <?php if($search["verify"] == '0'): ?>selected="selected"<?php endif; ?>>未验证</option>
                </select>                
              
                <!--br />
                <b>统计条件:</b><br />
                分组统计:
                <label><input type="radio" name="group" <?php if($search["group"] == 'bigcity.id'): ?>checked=""<?php endif; ?> value="bigcity.id" />按省份</label>  
                <label><input type="radio" name="group" <?php if($search["group"] == 'city.id'): ?>checked=""<?php endif; ?> value="city.id" />按地市</label>                                
                <label><input type="radio" name="group" <?php if($search["group"] == 'r.id'): ?>checked=""<?php endif; ?> value="r.id" />按片区统计</label>
                <label><input type="radio" name="group" <?php if($search["group"] == 's.storeId'): ?>checked=""<?php endif; ?> value="s.storeId" />按厅店统计</label>
            <label><input type="radio" name="group" <?php if($search["group"] == 'm.brandId'): ?>checked=""<?php endif; ?> value="m.brandId" />按品牌统计</label>                
                <label><input type="radio" name="group" <?php if($search["group"] == 's.modelId'): ?>checked=""<?php endif; ?> value="s.modelId" />按机型统计</label>
                <label><input type="radio" name="group" <?php if($search["group"] == 's.userId'): ?>checked=""<?php endif; ?> value="s.userId" />按人员统计</label>

                              
                <label><input type="radio" name="group" <?php if($search["group"] == ''): ?>checked=""<?php endif; ?> value="" />取消</label-->          
                <input type="hidden" name="opttype" value="search" />      
                <input type="button" name="search" class="btn" value="搜索" />
                <input type="button" name="export" class="btn" value="导出excel" />
					
                </div>
                </td>
            </tr>
        </tbody>
    </table>
    </form>


    <div class="J_tablelist table_list" data-acturi="<?php echo U('store/ajax_edit');?>">
        <table width="100%" cellspacing="0">
            <thead>
            <tr>
                <th width="40"><input type="checkbox" name="checkall" class="J_checkall"></th>
                <th width="40">ID</th>
                <th><span data-tdtype="order_by" data-field="storeId"><?php echo L('store_name');?></span></th>
                <th>亚信编码</th>
                
                <th><?php echo L('REGION_CATE_NAME');?></th>
                <th><span data-tdtype="order_by" data-field="modelId">机型</span></th>
                <th><span data-tdtype="order_by" data-field="userId">销售人员</span></th>
                <th><span data-tdtype="order_by" data-field="imei">imei</span></th>
                <th><span data-tdtype="order_by" data-field="createTime">销售时间</span></th>
                <th>验证信息</th>
      		    <th><span data-tdtype="order_by" data-field="number">数量</span></th>
                <!--th width=100><?php echo L('operations_manage');?></th-->
            </tr>
            </thead>
    	    <tbody>
            <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($i % 2 );++$i;?><tr>
                <td align="center"><input type="checkbox" class="J_checkitem" value="<?php echo ($val["id"]); ?>"></td>
                <td align="center"><?php echo ($val["id"]); ?></td>
                <td align="center"><?php echo ($val['storeName']); ?></td>
                <td align="center"><?php echo ($val['storeCtms']); ?></td>
                
                <td align="center">
                    <?php if($search["group"] == 'bigcity.id'): echo ($val["bigcityName"]); ?>
                    <?php elseif($search["group"] == 'city.id'): ?>
                        <?php echo ($val["bigcityName"]); ?>=》<?php echo ($val["cityName"]); ?>
                    <?php else: ?>
                        <?php echo ($val["bigcityName"]); ?>=》<?php echo ($val["cityName"]); ?>=》<?php echo ($val["regionName"]); endif; ?>
                </td>
                
                <td align="center"><?php echo ($val['modelName']); ?></td>
                
                <td align="center"><?php echo ($val['userRealName']); ?></td>
                <td align="center"><?php echo ($val["imei"]); ?></td>
                <td align="center"><?php echo ($val["createTime"]); ?></td>
                <td align="center"><?php if($val["verify"] == 1): ?>有效<?php elseif($val["verify"] == -1): ?>无效<?php else: ?>未验证<?php endif; ?></td>
                <td align="center"><?php if($val["number"] > 0): echo ($val["number"]); else: ?>1<?php endif; ?></td>
                <td align="center">
                
                    <!--a href="javascript:;" class="J_confirmurl" data-uri="<?php echo U('sales/delete', array('id'=>$val['id']));?>" data-msg="<?php echo sprintf(L('confirm_delete_one'),$val['name']);?>"><?php echo L('delete');?></a-->
                </td>
            </tr><?php endforeach; endif; else: echo "" ;endif; ?>
    	   </tbody>
        </table>
    </div>
    <div class="btn_wrap_fixed">
		<label class="select_all mr10"><input type="checkbox" name="checkall" class="J_checkall"><?php echo L('select_all');?>/<?php echo L('cancel');?></label>
    	<input type="button" class="btn" data-tdtype="batch_action" data-acttype="ajax" data-uri="<?php echo U('sales/delete');?>" data-name="id" data-msg="<?php echo L('confirm_delete');?>" value="<?php echo L('delete');?>" />
		<div id="pages"><?php echo ($page); ?></div>
    </div>
</div>
<script src="__STATIC__/js/jquery/jquery.js"></script>
<script src="__STATIC__/js/jquery/plugins/jquery.tools.min.js"></script>
<script src="__STATIC__/js/jquery/plugins/formvalidator.js"></script>
<script src="__STATIC__/js/pinphp.js"></script>
<script src="__STATIC__/js/admin.js"></script>
<script>
//初始化弹窗
(function (d) {
    d['okValue'] = lang.dialog_ok;
    d['cancelValue'] = lang.dialog_cancel;
    d['title'] = lang.dialog_title;
})($.dialog.defaults);
</script>

<?php if(isset($list_table)): ?><script src="__STATIC__/js/jquery/plugins/listTable.js"></script>
<script>
$(function(){
	$('.J_tablelist').listTable();
});
</script><?php endif; ?>
<script>
$('.J_cate_select').cate_select({top_option:lang.all});
</script>
<link rel="stylesheet" type="text/css" href="__STATIC__/js/calendar/calendar-blue.css"/>
<script src="__STATIC__/js/calendar/calendar.js"></script>
<script>
Calendar.setup({
    inputField : "time_start",
    ifFormat   : "%Y-%m-%d",
    showsTime  : false,
    timeFormat : "24"
});
Calendar.setup({
    inputField : "time_end",
    ifFormat   : "%Y-%m-%d",
    showsTime  : false,
    timeFormat : "24"
});

$("#brand_select_add").change(function(){
   var _this = $("#brand_select_add");
   var brand_id = _this.val();
   var ajax_get_region = "<?php echo U('model/getModelList');?>";
   if(brand_id){
    $.ajax({
        url:ajax_get_region,
        data:"brand_id="+brand_id,
        dataType:"json",
        success:function(data){
            if(data.status==1){
                var str = '<option value="0">'+lang.please_select+'</option>';
                for(d in data.data){
                    str +='<option value="'+d+'">'+data['data'][d]+'</option>';
                }
                $("#model_select_add").html(str);
            }
        }
    });        
   }else{
        $("#model_select_add").empty();
   }  
 });
 $("#brand_select_add").change();
 
 $("input[name=search]").click(function(){
    $("input[name=opttype]").val('search');
    $("form[name=searchform]").attr('target','_self');
    $("form[name=searchform]").submit();
 });
 $("input[name=export]").click(function(){
    $("input[name=opttype]").val('export');
    $("form[name=searchform]").attr('target','_blank');
    $("form[name=searchform]").submit();
 });
</script>
</body>
</html>